package cz.czu.pef.DataModelling.domainObjects;

import java.util.*;

public class TrainingType extends CommonObjectImpl implements IdObject
{
  private static final long serialVersionUID = -3862163779167667385L;

  /*
	 * Entity attributes (some inherited).
	 */
  private long defaultPeriodInSeconds;

	private String evidencePassName;

	/*
	 * Relations
	 */
	//@OnDelete(action=OnDeleteAction.NO_ACTION)
	private Set<Training> trainings;

	private Set<TrainingTypeForRoleType> trainingTypeForRoleTypes;

	public TrainingType()
	{
		super(null, null, null);
	}

	public TrainingType(String trainingCode, String trainingName, String trainingDescription, String evidencePassName, long defaultPeriodInSeconds)
	{
		super(trainingCode, trainingName, trainingDescription);
		this.evidencePassName = evidencePassName;
		this.defaultPeriodInSeconds = defaultPeriodInSeconds;
	}

	public Set<Training> getTrainings()
	{
		return trainings;
	}

	public List<Training> getTrainingsAsList()
	{
		return new ArrayList<Training>(getTrainings());
	}

	public Set<TrainingTypeForRoleType> getTrainingTypeForRoleTypes()
	{
		return trainingTypeForRoleTypes;
	}

	public List<TrainingTypeForRoleType> getTrainingTypeForRoleTypesAsList()
	{
		return new ArrayList<TrainingTypeForRoleType>(getTrainingTypeForRoleTypes());
	}

	public long getDefaultPeriodInSeconds()
	{
		return defaultPeriodInSeconds;
	}

	public void setDefaultPeriodInSeconds(long defaultPeriodInSeconds)
	{
		this.defaultPeriodInSeconds = defaultPeriodInSeconds;
	}

	public String getEvidencePassName()
	{
		return evidencePassName;
	}

	public void setEvidencePassName(String evidencePassName)
	{
		this.evidencePassName = evidencePassName;
	}

	
  public void setTrainings(Set<Training> trainings)
  {
    this.trainings = trainings;
  }

  
  public void setTrainingTypeForRoleTypes(Set<TrainingTypeForRoleType> trainingTypeForRoleTypes)
  {
    this.trainingTypeForRoleTypes = trainingTypeForRoleTypes;
  }

  public String toString()
	{
		StringBuilder builder = new StringBuilder();
		builder.append("TrainingType [defaultPeriodInSeconds=");
		builder.append(defaultPeriodInSeconds);
		builder.append(", evidencePassName=");
		builder.append(evidencePassName);
		builder.append(", toString()=");
		builder.append(super.toString());
		builder.append("]");
		return builder.toString();
	}
}
